package com.topnav.mc.admin.controller;

import com.js.lib.annotation.ApiLogger;
import com.js.lib.result.Result;
import com.topnav.mc.admin.bean.MapInfoBean;
import com.topnav.mc.admin.entity.SystemConfig;
import com.topnav.mc.uitls.MapUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Api(value = "admin/map", tags = "地图参数")
@RestController
@CrossOrigin
@RequestMapping("admin/map")
public class MapController {

    @ApiLogger(apiName="/getMapInfo")
    @ApiOperation(value = "取得地图参数")
    @GetMapping("/getMapInfo")
    @ResponseBody
    public Result getMapInfo(){
        MapInfoBean data = new MapInfoBean();
        Map<String,Double> map = MapUtil.getCenterPoint();
        data.setCenterLongitude(map.get("longitude"));
        data.setCenterLatitude(map.get("latitude"));

        Map<String,Integer> map1 = MapUtil.getZoomLevel();
        data.setMinZoom(map1.get("minZoom"));
        data.setMaxZoom(map1.get("maxZoom"));

        data.setMode(MapUtil.getMode());
        data.setCoord(MapUtil.getCoord());
        data.setName(MapUtil.getName());
        data.setSubName(MapUtil.getSubName());
        data.setDefaultZoom(MapUtil.getDefaultZoom());
        return Result.ok(data);
    }

}
